Skip to content

Block plot creation when deadline expired — frontend + API#807

Merged
realproject7 merged 3 commits intomainfrom
task/804-deadline-enforcement
Apr 3, 2026
Merged

Block plot creation when deadline expired — frontend + API#807
realproject7 merged 3 commits intomainfrom
task/804-deadline-enforcement

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

Three-layer deadline enforcement to prevent wasted gas on doomed transactions:

  1. Storyline page (AddPlotButton.tsx): Checks last_plot_time + 168h < now. Shows disabled "Deadline expired" instead of clickable link
  2. Create page (create/page.tsx): Filters expired storylines from the dropdown (removed sunset=false DB filter, now checks both sunset and time-based expiry client-side)
  3. API indexer (api/index/plot/route.ts): Returns 400 when storyline deadline has expired or sunset is true

Also exports DEADLINE_HOURS from DeadlineCountdown.tsx for shared reuse.

Changes

  • src/components/AddPlotButton.tsx — added deadline check + disabled state
  • src/components/DeadlineCountdown.tsx — exported DEADLINE_HOURS
  • src/app/story/[storylineId]/page.tsx — passes lastPlotTime to AddPlotButton
  • src/app/create/page.tsx — client-side expired filter, includes sunset storylines from DB
  • src/app/api/index/plot/route.ts — deadline + sunset validation before upsert

Test Plan

  • Storyline page: expired story shows disabled "Deadline expired" button
  • Storyline page: active story shows clickable "+ Add a new Plot"
  • Create page: expired storylines not in dropdown
  • API: POST to index/plot for expired storyline returns 400
  • Contract enforcement unchanged

Fixes #804

🤖 Generated with Claude Code

1. AddPlotButton: check last_plot_time + 168h, show disabled
   "Deadline expired" state instead of clickable link
2. Create page: filter expired storylines from dropdown
3. API index/plot: reject with 400 when deadline expired or sunset
4. Export DEADLINE_HOURS from DeadlineCountdown for reuse

Fixes #804

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored Apr 3, 2026 11:13am

Request Review

Export DEADLINE_MS from DeadlineCountdown.tsx alongside DEADLINE_HOURS.
Create page now imports DEADLINE_MS instead of hardcoding. API route
keeps local constant (server-side can't import client component) but
documents the source.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST CHANGES

Summary

The API validation looks directionally correct, but the frontend implementation does not match two explicit requirements from issue #804. In particular, expired storylines are removed from the Create dropdown instead of shown disabled, and sunset=true storylines still hide the add-plot control entirely instead of rendering a disabled state.

Findings

  • [medium] The Create page filters expired storylines out of the dropdown entirely, but issue #804 requires them to remain visible and disabled with an (expired) label.

    • File: src/app/create/page.tsx:537
    • Suggestion: Keep expired storylines in options, mark them disabled, and append an (expired) suffix so writers can see why they are unavailable.
  • [medium] The storyline page still suppresses the add-plot control completely when sunset=true, so the user never sees the required disabled state for expired/sunset storylines.

    • File: src/app/story/[storylineId]/page.tsx:375
    • Suggestion: Render AddPlotButton regardless of sunset, and let the component handle the disabled presentation for both deadline-expired and sunset cases.

Decision

Requesting changes until the frontend behavior matches the issue's stated UX: visible-but-disabled on the storyline page, and visible-but-disabled entries in the Create dropdown.

1. Create page: expired storylines shown in dropdown with "(expired)"
   label and disabled (not selectable). Added disabled option support
   to Select component.
2. Storyline page: AddPlotButton now shown for sunset storylines too,
   renders disabled "Deadline expired" state. Removed !sunset guard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The follow-up change resolves my prior frontend blockers. Expired storylines now stay visible-but-disabled in the Create dropdown, and the storyline page now renders the add-plot control in a disabled state for expired/sunset storylines instead of hiding it.

Findings

  • [resolved] Expired storylines remain in the Create dropdown with an (expired) suffix and disabled selection behavior.

    • File: src/app/create/page.tsx:536
    • File: src/components/Select.tsx:5
    • Suggestion: None.
  • [resolved] The storyline page now always renders AddPlotButton, and the component handles disabled presentation for deadline-expired and sunset storylines.

    • File: src/app/story/[storylineId]/page.tsx:375
    • File: src/components/AddPlotButton.tsx:28
    • Suggestion: None.

Decision

Approving. My prior blockers on the frontend UX requirements from issue #804 are addressed.

@realproject7 realproject7 merged commit fa432d7 into main Apr 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Block new plot creation when deadline is expired — front-end + API

2 participants